package com.pro.back.controller;

import com.pro.back.bean.Repair;
import com.pro.back.bean.common.ApiRes;
import com.pro.back.bean.po.RepairPO;
import com.pro.back.service.RepairService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: jingwenjuan
 * @Description:
 * @Date: 2025-04-19
 */
@RestController
@RequestMapping("/repair")
public class RepairController {

    @Autowired
    private RepairService repairService;


    @ApiOperation("查看所有的报修检修信息")
    @PostMapping("/selectAllRepair")
    public ApiRes selectAllRepair(@RequestBody RepairPO po) {
        return repairService.selectAllRepair(po);
    }


    @ApiOperation("新增报修记录")
    @PostMapping("/insertRepair")
    public ApiRes insertRepair(@RequestBody Repair repair) {
        return repairService.insertRepair(repair);
    }

    @ApiOperation("审核报修信息")
    @PostMapping("/updateRepair")
    public ApiRes updateRepair(@RequestBody Repair repair) {
        return repairService.updateRepair(repair);
    }

    @ApiOperation("检修结束操作")
    @PostMapping("/exitRepair")
    public ApiRes exitRepair(@RequestBody Repair repair) {
        return repairService.exitRepair(repair);
    }

    @ApiOperation("设备报废")
    @GetMapping("/delDevice")
    public ApiRes delDevice(Long id) {
        return repairService.delDevice(id);
    }

    @ApiOperation("删除维修信息")
    @GetMapping("/delRepair")
    public ApiRes delRepair(Long id) {
        return repairService.delRepairInfo(id);
    }
}
